import {
	dept,
	xminerToken
} from '@/api/customApi';

// 442864853551416544 顶层 447759831718167808
export async function deptFn() {
	async function fn(Parent, id, token) {
		let res = await dept(id, token)
		Parent.push(...res);
		for (let i = 0, len = res.length; i < len; i++) {
			if (res[i].exitChilren) {
				await fn(res[i].children, res[i].node_id, token)
			}
		}
		return Parent
	}

	const {
		data: [{
			token
		}]
	} = await xminerToken();

	return fn([], "447759831718167808", token)
}